from src.notify import wechat, send_mail, ding_talk, lark


def report_notification(notification_type, test_result):
    if notification_type.strip() == "0":
        return
    mapping = {
        "1": wechat.WeChatSend,
        "2": ding_talk.DingTalkSend,
        "3": lark.LarkSend,
        "4": send_mail.SendEmail,
    }
    if "," in notification_type:
        notification_type = notification_type.split(",")
    elif "，" in notification_type:
        notification_type = notification_type.split("，")
    for index in notification_type:
        mapping.get(index.strip())(test_result).send()
